CC=gcc
INC = -I/usr/include/postgresql
LIB_DB = /usr/lib/pgsql
CCFLAG=-Wall -g $(INC) 
ECPGFLAGS = -t $(INC)

.SUFFIXES:  .pgc
.pgc.c:		#double colon suffix rule
	@echo "start preprocess..."
	ecpg $(ECPGFLAGS) $<

all	:	test clean

.c.o:
	@echo "start compiling..."
	$(CC) $(CCFLAG) -c $< 

test	:	test.o
	@echo "start linking..."
	$(CC) -o $@ $(CCFLAG) $< -L$(LIB_DB) -lecpg -lpq
	

.PHONY	:	clean
clean	:
	rm -f *.c
	rm -f *.o

